<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="keywords" content="董哲朋,博客,杰森,工程师杰森,攻城狮杰森,程序员杰森,jason,jasoncoding,pdpeng.github.io,coder-jason,杰森,工程师,攻城狮,程序员,blog,杰森的博客,全栈杰森,Jason,全栈">
<meta name="description" content="董哲朋的个人技术博客，进军 BAT">
<meta name="baidu-site-verification" content="code-QreKZHvhxr" />
<meta name="google-site-verification" content="09pUELCUBq1DqCCF38Yh2tJ3Ym_AwCrftq7Nuj6RFKU" />
<meta name="baidu-site-verification" content="code-UgQbVCF7gr" />
<meta name="google-site-verification" content="2Z5MbRq2MYkpxhxZigsnWu_02ovzdGiRJNOzHc_yq58" />
<meta name="sogou_site_verification" content="kR3XmMWqhc" />
<meta name="viewport" content="width=device-width">
<meta name="referrer" content="no-referrer" /> <!--临时解决防盗链-->
<meta name="theme-color" content="#222" media="(prefers-color-scheme: light)">
<meta name="theme-color" content="#222" media="(prefers-color-scheme: dark)"><meta name="generator" content="Hexo 6.3.0">

<link rel="preconnect" href="null//null" crossorigin>
<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin>
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">
  <meta name="google-site-verification" content="yRcH84LYotQhqYFJcwA5UzGRX_E_HGt7EWyA1hBqqWU">
  <meta name="msvalidate.01" content="yRcH84LYotQhqYFJcwA5UzGRX_E_HGt7EWyA1hBqqWU">
  <meta name="yandex-verification" content="8db608d56597d365">
  <meta name="baidu-site-verification" content="code-SSriojapxO">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.1.1/css/all.min.css" integrity="sha256-DfWjNxDkM94fVBWx1H5BMMp0Zq7luBlV8QRcSES7s+0=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css" integrity="sha256-Vzbj7sDDS/woiFS3uNKo8eIuni59rjyNGtXfstRzStA=" crossorigin="anonymous">

<script class="next-config" data-name="main" type="application/json">{"hostname":"pdpeng.github.io","root":"/","images":"/images","scheme":"Mist","darkmode":true,"version":"8.11.1","exturl":true,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":true,"bookmark":{"enable":false,"color":"#222","save":"manual"},"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":"utterances","storage":true,"lazyload":true,"nav":null,"activeClass":"utterances"},"stickytabs":false,"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}}</script><script src="/js/config.js"></script>



<link rel="canonical" href="https://pdpeng.github.io/2022/02/10/3d-olympics/">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"https://pdpeng.github.io/2022/02/10/3d-olympics/","path":"2022/02/10/3d-olympics/","title":"超震撼! 裸眼 3D 看冬奥"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>超震撼! 裸眼 3D 看冬奥 | 攻城狮杰森</title>
  
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-5S6WNTLJG7"></script>
  <script class="next-config" data-name="google_analytics" type="application/json">{"tracking_id":"G-5S6WNTLJG7","only_pageview":false}</script>
  <script src="/js/third-party/analytics/google-analytics.js"></script>

  <script src="/js/third-party/analytics/baidu-analytics.js"></script>
  <script async src="https://hm.baidu.com/hm.js?11b3816992997637c6abc9c18c3eb3e5"></script>

  <script async src="//assets.growingio.com/2.1/gio.js"></script>
  <script class="next-config" data-name="growingio_analytics" type="application/json">"88ac8d4f08101068"</script>
  <script src="/js/third-party/analytics/growingio.js"></script>



  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
<link rel="alternate" href="/atom.xml" title="攻城狮杰森" type="application/atom+xml">
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">攻城狮杰森</p>
      <i class="logo-line"></i>
    </a>
      <p class="site-subtitle" itemprop="description">董哲朋的博客</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类<span class="badge">22</span></a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档<span class="badge">105</span></a></li><li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签<span class="badge">28</span></a></li><li class="menu-item menu-item-about"><a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</div>
        
  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>

  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%95%88%E6%9E%9C"><span class="nav-number">1.</span> <span class="nav-text">效果</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E7%9F%A5%E8%AF%86%E7%82%B9"><span class="nav-number">2.</span> <span class="nav-text">知识点</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%AE%9E%E7%8E%B0"><span class="nav-number">3.</span> <span class="nav-text">实现</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%BC%95%E5%85%A5%E8%B5%84%E6%BA%90"><span class="nav-number">3.1.</span> <span class="nav-text">引入资源</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E9%A1%B5%E9%9D%A2-DOM-%E7%BB%93%E6%9E%84"><span class="nav-number">3.2.</span> <span class="nav-text">页面 DOM 结构</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%9C%BA%E6%99%AF%E5%88%9D%E5%A7%8B%E5%8C%96"><span class="nav-number">3.3.</span> <span class="nav-text">场景初始化</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%B7%BB%E5%8A%A0%E5%85%89%E6%BA%90"><span class="nav-number">3.4.</span> <span class="nav-text">添加光源</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%8A%A0%E8%BD%BD%E8%BF%9B%E5%BA%A6%E7%AE%A1%E7%90%86"><span class="nav-number">3.5.</span> <span class="nav-text">加载进度管理</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%88%9B%E5%BB%BA%E5%9C%B0%E9%9D%A2"><span class="nav-number">3.6.</span> <span class="nav-text">创建地面</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%88%9B%E5%BB%BA%E5%86%AC%E5%A5%A5%E5%90%89%E7%A5%A5%E7%89%A9%E5%86%B0%E5%A2%A9%E5%A2%A9"><span class="nav-number">3.7.</span> <span class="nav-text">创建冬奥吉祥物冰墩墩</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%88%9B%E5%BB%BA%E5%A5%A5%E8%BF%90%E4%BA%94%E7%8E%AF"><span class="nav-number">3.8.</span> <span class="nav-text">创建奥运五环</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#%F0%9F%92%A1-TorusGeometry-%E5%9C%86%E7%8E%AF%E9%9D%A2"><span class="nav-number">3.8.1.</span> <span class="nav-text">💡 TorusGeometry 圆环面</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%F0%9F%92%A1-MeshLambertMaterial-%E9%9D%9E%E5%85%89%E6%B3%BD%E8%A1%A8%E9%9D%A2%E6%9D%90%E8%B4%A8"><span class="nav-number">3.8.2.</span> <span class="nav-text">💡 MeshLambertMaterial 非光泽表面材质</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%88%9B%E5%BB%BA%E6%97%97%E5%B8%9C"><span class="nav-number">3.9.</span> <span class="nav-text">创建旗帜</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%88%9B%E5%BB%BA%E6%A0%91%E6%9C%A8"><span class="nav-number">3.10.</span> <span class="nav-text">创建树木</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#%F0%9F%92%A1-MeshDepthMaterial-%E6%B7%B1%E5%BA%A6%E7%BD%91%E6%A0%BC%E6%9D%90%E8%B4%A8"><span class="nav-number">3.10.1.</span> <span class="nav-text">💡 MeshDepthMaterial 深度网格材质</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%F0%9F%92%A1-custromMaterial-%E8%87%AA%E5%AE%9A%E4%B9%89%E6%9D%90%E8%B4%A8"><span class="nav-number">3.10.2.</span> <span class="nav-text">💡 custromMaterial 自定义材质</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%88%9B%E5%BB%BA%E9%9B%AA%E8%8A%B1"><span class="nav-number">3.11.</span> <span class="nav-text">创建雪花</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#%F0%9F%92%A1-Points-%E7%B2%92%E5%AD%90"><span class="nav-number">3.11.1.</span> <span class="nav-text">💡 Points 粒子</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%F0%9F%92%A1-PointsMaterial-%E7%82%B9%E6%9D%90%E8%B4%A8"><span class="nav-number">3.11.2.</span> <span class="nav-text">💡 PointsMaterial 点材质</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%F0%9F%92%A1-%E6%9D%90%E8%B4%A8%E5%B1%9E%E6%80%A7-blending"><span class="nav-number">3.11.3.</span> <span class="nav-text">💡 材质属性 .blending</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%F0%9F%92%A1-%E6%9D%90%E8%B4%A8%E5%B1%9E%E6%80%A7-sizeAttenuation"><span class="nav-number">3.11.4.</span> <span class="nav-text">💡 材质属性 .sizeAttenuation</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#%F0%9F%92%A1-Three-js-%E5%90%91%E9%87%8F"><span class="nav-number">3.11.5.</span> <span class="nav-text">💡 Three.js 向量</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E9%95%9C%E5%A4%B4%E6%8E%A7%E5%88%B6%E3%80%81%E7%BC%A9%E6%94%BE%E9%80%82%E9%85%8D%E3%80%81%E5%8A%A8%E7%94%BB"><span class="nav-number">3.12.</span> <span class="nav-text">镜头控制、缩放适配、动画</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%80%BB%E7%BB%93"><span class="nav-number">4.</span> <span class="nav-text">总结</span></a></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <a href="/">
    <img class="site-author-image" itemprop="image" alt="董哲朋"
      src="/images/head_portrait.png">
    </a>
  <p class="site-author-name" itemprop="name">董哲朋</p>
  <div class="site-description" itemprop="description" style="padding-bottom: 8px">A blacksmith must be strong</div>

<html>
<head>
    <style>
        .chat-button div {
            display: block;
            margin-top: 5px;
            background-color: transparent;
            position: relative;
            font-family: 'Lato', "PingFang SC", "Microsoft YaHei", sans-serif;
            font-size: 14px;
            line-height: 2;
        }

        .feed-link a {
            display: inline-block;
            padding: 0 15px;
            color: #fc6423;
            border: 2px solid #fc6423;
            border-radius: 6px;
            text-decoration: none;
        }

        .feed-link a:hover {
            background-color: #fc6423;
            border-bottom-color: #fc6423;
            color: #fff;
        }
    </style>
</head>

<body class="chat-button">
    <div class="feed-link" title="Q&A → Blog-Jason/community">
        <a target="_blank" rel="noopener" href="https://gitter.im/Blog-Jason/community">
            Q&A
        </a>
    </div>
</body>
</html>

</div>
<div class="site-state-wrap site-overview-item animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">105</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">22</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
          <a href="/tags/">
        <span class="site-state-item-count">28</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author site-overview-item animated">
      <span class="links-of-author-item">
        <span class="exturl" data-url="aHR0cHM6Ly93d3cubGlua2VkaW4uY29tL2luL2Rvbmd6aGVwZW5n" title="Linkedin → https:&#x2F;&#x2F;www.linkedin.com&#x2F;in&#x2F;dongzhepeng"><i class="fab fa-linkedin fa-fw"></i>Linkedin</span>
      </span>
      <span class="links-of-author-item">
        <span class="exturl" data-url="aHR0cHM6Ly90d2l0dGVyLmNvbS9qYXNvbmk5OTY=" title="Twitter → https:&#x2F;&#x2F;twitter.com&#x2F;jasoni996"><i class="fab fa-twitter fa-fw"></i>Twitter</span>
      </span>
      <span class="links-of-author-item">
        <span class="exturl" data-url="bWFpbHRvOmR6aGVwZW5nQGdtYWlsLmNvbQ==" title="E-Mail → mailto:dzhepeng@gmail.com"><i class="fa fa-envelope fa-fw"></i>E-Mail</span>
      </span>
      <span class="links-of-author-item">
        <span class="exturl" data-url="aHR0cHM6Ly9zdGFja292ZXJmbG93LmNvbS91c2Vycy8xNjY0ODc1NA==" title="S.O. → https:&#x2F;&#x2F;stackoverflow.com&#x2F;users&#x2F;16648754"><i class="fab fa-stack-overflow fa-fw"></i>S.O.</span>
      </span>
      <span class="links-of-author-item">
        <a href="/atom.xml" title="RSS → &#x2F;atom.xml"><i class="fa fa-rss fa-fw"></i>RSS</a>
      </span>
      <span class="links-of-author-item">
        <span class="exturl" data-url="aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L20wXzUxMjY5OTYx" title="CSDN → https:&#x2F;&#x2F;blog.csdn.net&#x2F;m0_51269961"><i class="fa-solid fa-c fa-fw"></i>CSDN</span>
      </span>
  </div>
  <div class="cc-license site-overview-item animated" itemprop="license">
    <span class="exturl cc-opacity" data-url="aHR0cHM6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL2xpY2Vuc2VzL2J5LW5jLXNhLzQuMC8="><img src="https://cdn.jsdelivr.net/npm/@creativecommons/vocabulary@2020.11.3/assets/license_badges/small/by_nc_sa.svg" alt="Creative Commons"></span>
  </div>



        </div>
      </div>

      
      <script type="text/javascript" charset="utf-8" src="/js/tagcloud.js"></script>
      <script type="text/javascript" charset="utf-8" src="/js/tagcanvas.js"></script>
      <div class="widget-wrap">
          <div id="myCanvasContainer" class="widget tagcloud">
              <canvas width="250" height="250" id="resCanvas" style="width:100%">
                  <ul class="tag-list" itemprop="keywords"><li class="tag-list-item"><a class="tag-list-link" href="/tags/ACM/" rel="tag">ACM</a><span class="tag-list-count">32</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/C/" rel="tag">C++</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/CDN/" rel="tag">CDN</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/CPU/" rel="tag">CPU</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/DNS/" rel="tag">DNS</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Git/" rel="tag">Git</a><span class="tag-list-count">9</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/HarmonyOS/" rel="tag">HarmonyOS</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Hexo/" rel="tag">Hexo</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/IOS/" rel="tag">IOS</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Java/" rel="tag">Java</a><span class="tag-list-count">9</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Linux/" rel="tag">Linux</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Markdown/" rel="tag">Markdown</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/MySQL/" rel="tag">MySQL</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Python/" rel="tag">Python</a><span class="tag-list-count">4</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/RT-Thread/" rel="tag">RT-Thread</a><span class="tag-list-count">3</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/SQLServer/" rel="tag">SQLServer</a><span class="tag-list-count">9</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/TCP-IP/" rel="tag">TCP&#x2F;IP</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Tomcat/" rel="tag">Tomcat</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Vivado/" rel="tag">Vivado</a><span class="tag-list-count">2</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E4%BA%91%E5%AD%98%E5%82%A8/" rel="tag">云存储</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E5%89%8D%E7%AB%AF/" rel="tag">前端</a><span class="tag-list-count">6</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E6%9C%8D%E5%8A%A1%E5%99%A8/" rel="tag">服务器</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E7%A8%8B%E5%BA%8F%E4%BA%BA%E7%94%9F/" rel="tag">程序人生</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E7%BC%96%E7%A0%81/" rel="tag">编码</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E8%81%8C%E4%B8%9A%E8%AE%A4%E8%AF%81/" rel="tag">职业认证</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88/" rel="tag">解决方案</a><span class="tag-list-count">6</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E8%A7%A3%E6%9E%90%E5%87%A0%E4%BD%95/" rel="tag">解析几何</a><span class="tag-list-count">1</span></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/%E8%AE%A1%E7%AE%97%E6%9C%BA%E8%A7%86%E8%A7%89/" rel="tag">计算机视觉</a><span class="tag-list-count">1</span></li></ul>
              </canvas>
          </div>
      </div>
      
        <div class="back-to-top animated" role="button" aria-label="返回顶部">
          <i class="fa fa-arrow-up"></i>
          <span>0%</span>
        </div>
    </div>
  </aside>
  <div class="sidebar-dimmer"></div>


    </header>

    
  <div class="reading-progress-bar"></div>

  <span class="exturl github-corner" data-url="aHR0cHM6Ly9naXRodWIuY29tL1BEUEVORw==" title="Follow Jason on GitHub" aria-label="Follow Jason on GitHub"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></span>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://pdpeng.github.io/2022/02/10/3d-olympics/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/head_portrait.png">
      <meta itemprop="name" content="董哲朋">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="攻城狮杰森">
      <meta itemprop="description" content="A blacksmith must be strong">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="超震撼! 裸眼 3D 看冬奥 | 攻城狮杰森">
      <meta itemprop="description" content="">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          超震撼! 裸眼 3D 看冬奥
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2022-02-10 17:04:32" itemprop="dateCreated datePublished" datetime="2022-02-10T17:04:32+08:00">2022-02-10</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E7%A8%8B%E5%BA%8F%E8%AE%BE%E8%AE%A1/" itemprop="url" rel="index"><span itemprop="name">程序设计</span></a>
        </span>
    </span>

  
    <span id="/2022/02/10/3d-olympics/" class="post-meta-item leancloud_visitors" data-flag-title="超震撼! 裸眼 3D 看冬奥" title="阅读次数">
      <span class="post-meta-item-icon">
        <i class="far fa-eye"></i>
      </span>
      <span class="post-meta-item-text">阅读次数：</span>
      <span class="leancloud-visitors-count"></span>
    </span>
    <span class="post-meta-break"></span>
    <span class="post-meta-item" title="本文字数">
      <span class="post-meta-item-icon">
        <i class="far fa-file-word"></i>
      </span>
      <span class="post-meta-item-text">本文字数：</span>
      <span>12k</span>
    </span>
    <span class="post-meta-item" title="阅读时长">
      <span class="post-meta-item-icon">
        <i class="far fa-clock"></i>
      </span>
      <span class="post-meta-item-text">阅读时长 &asymp;</span>
      <span>11 分钟</span>
    </span>
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <p>大家好，我是杰森。北京 2022 冬奥会备受瞩目，吉祥物冰墩墩更是圈粉无数。</p>
<p>不知道你有没有抢到一只呢？</p>
<p><img src="https://cdn.jsdelivr.net/gh/PDPENG/jason-storage/blog-img/bingdwendwen.png"></p>
<p>本文使用 <code>Three.js + React</code> 技术栈，实现冬日和奥运元素，制作了一个充满趣味和纪念意义的冬奥主题 <code>3D</code> 页面。</p>
<h2 id="效果"><a href="#效果" class="headerlink" title="效果"></a>效果</h2><p>实现效果如以下 <code>👇</code> 动图所示，页面主要由 <code>2022</code> 冬奥会吉祥物 <code>冰墩墩</code> 、奥运五环、舞动的旗帜 <code>🚩</code>、树木 <code>🌲</code> 以及下雪效果 <code>❄️</code> 等组成。按住鼠标左键移动可以改为相机位置，获得不同视图。</p>
<p><img src="https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/dcb9253a007d4a4a9b749569428036f1~tplv-k3u1fbpfcp-watermark.awebp"></p>
<blockquote>
<p><code>👀</code> 在线预览：<span class="exturl" data-url="aHR0cHM6Ly9kcmFnb25pci5naXRodWIuaW8vM2QvIy9vbHltcGljJUVGJUJDJTg4JUU5JTgzJUE4JUU3JUJEJUIyJUU1JTlDJUE4">https://dragonir.github.io/3d/#/olympic（部署在<i class="fa fa-external-link-alt"></i></span> <code>GitHub</code>，加载速度可能会有点慢 <code>😓</code>）</p>
</blockquote>
<span id="more"></span>

<h2 id="知识点"><a href="#知识点" class="headerlink" title="知识点"></a>知识点</h2><p>本文涉及到的知识点主要包括：<code>TorusGeometry</code> 圆环面、<code>MeshLambertMaterial</code> 非光泽表面材质、<code>MeshDepthMaterial</code> 深度网格材质、<code>custromMaterial</code> 自定义材质、<code>Points</code> 粒子、<code>PointsMaterial</code> 点材质等。</p>
<h2 id="实现"><a href="#实现" class="headerlink" title="实现"></a>实现</h2><h3 id="引入资源"><a href="#引入资源" class="headerlink" title="引入资源"></a>引入资源</h3><p>首先引入开发页面所需要的库和外部资源，<code>OrbitControls</code> 用于镜头轨道控制、<code>TWEEN</code> 用于补间动画实现、<code>GLTFLoader</code> 用于加载 <code>glb</code> 或 <code>gltf</code> 格式的 <code>3D</code> 模型、以及一些其他模型、贴图等资源。</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> <span class="title class_">React</span> <span class="keyword">from</span> <span class="string">&#x27;react&#x27;</span>;</span><br><span class="line"><span class="keyword">import</span> &#123; <span class="title class_">OrbitControls</span> &#125; <span class="keyword">from</span> <span class="string">&quot;three/examples/jsm/controls/OrbitControls&quot;</span>;</span><br><span class="line"><span class="keyword">import</span> &#123; <span class="variable constant_">TWEEN</span> &#125; <span class="keyword">from</span> <span class="string">&quot;three/examples/jsm/libs/tween.module.min.js&quot;</span>;</span><br><span class="line"><span class="keyword">import</span> &#123; <span class="title class_">GLTFLoader</span> &#125; <span class="keyword">from</span> <span class="string">&quot;three/examples/jsm/loaders/GLTFLoader&quot;</span>;</span><br><span class="line"><span class="keyword">import</span> bingdundunModel <span class="keyword">from</span> <span class="string">&#x27;./models/bingdundun.glb&#x27;</span>;</span><br><span class="line"><span class="comment">// ...</span></span><br></pre></td></tr></table></figure>

<h3 id="页面-DOM-结构"><a href="#页面-DOM-结构" class="headerlink" title="页面 DOM 结构"></a>页面 DOM 结构</h3><p>页面 <code>DOM</code> 结构非常简单，只有渲染 <code>3D</code> 元素的 <code>#container</code> 容器和显示加载进度的 <code>.olympic_loading</code>元素。</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">&lt;div&gt;</span><br><span class="line">  <span class="language-xml"><span class="tag">&lt;<span class="name">div</span> <span class="attr">id</span>=<span class="string">&quot;container&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span></span><br><span class="line">  &#123;<span class="variable language_">this</span>.<span class="property">state</span>.<span class="property">loadingProcess</span> === <span class="number">100</span> ? <span class="string">&#x27;&#x27;</span> : (</span><br><span class="line">    <span class="language-xml"><span class="tag">&lt;<span class="name">div</span> <span class="attr">className</span>=<span class="string">&quot;olympic_loading&quot;</span>&gt;</span></span></span><br><span class="line"><span class="language-xml">      <span class="tag">&lt;<span class="name">div</span> <span class="attr">className</span>=<span class="string">&quot;box&quot;</span>&gt;</span>&#123;this.state.loadingProcess&#125; %<span class="tag">&lt;/<span class="name">div</span>&gt;</span></span></span><br><span class="line"><span class="language-xml">    <span class="tag">&lt;/<span class="name">div</span>&gt;</span></span></span><br><span class="line">  )&#125;</span><br><span class="line">&lt;/div&gt;</span><br></pre></td></tr></table></figure>

<h3 id="场景初始化"><a href="#场景初始化" class="headerlink" title="场景初始化"></a>场景初始化</h3><p>初始化渲染容器、场景、相机。关于这部分内容的详细知识点，可以查阅我往期的文章，本文中不再赘述。</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">container = <span class="variable language_">document</span>.<span class="title function_">getElementById</span>(<span class="string">&#x27;container&#x27;</span>);</span><br><span class="line">renderer = <span class="keyword">new</span> <span class="variable constant_">THREE</span>.<span class="title class_">WebGLRenderer</span>(&#123; <span class="attr">antialias</span>: <span class="literal">true</span> &#125;);</span><br><span class="line">renderer.<span class="title function_">setPixelRatio</span>(<span class="variable language_">window</span>.<span class="property">devicePixelRatio</span>);</span><br><span class="line">renderer.<span class="title function_">setSize</span>(<span class="variable language_">window</span>.<span class="property">innerWidth</span>, <span class="variable language_">window</span>.<span class="property">innerHeight</span>);</span><br><span class="line">renderer.<span class="property">shadowMap</span>.<span class="property">enabled</span> = <span class="literal">true</span>;</span><br><span class="line">container.<span class="title function_">appendChild</span>(renderer.<span class="property">domElement</span>);</span><br><span class="line">scene = <span class="keyword">new</span> <span class="variable constant_">THREE</span>.<span class="title class_">Scene</span>();</span><br><span class="line">scene.<span class="property">background</span> = <span class="keyword">new</span> <span class="variable constant_">THREE</span>.<span class="title class_">TextureLoader</span>().<span class="title function_">load</span>(skyTexture);</span><br><span class="line">camera = <span class="keyword">new</span> <span class="variable constant_">THREE</span>.<span class="title class_">PerspectiveCamera</span>(<span class="number">60</span>, <span class="variable language_">window</span>.<span class="property">innerWidth</span> / <span class="variable language_">window</span>.<span class="property">innerHeight</span>, <span class="number">0.1</span>, <span class="number">1000</span>);</span><br><span class="line">camera.<span class="property">position</span>.<span class="title function_">set</span>(<span class="number">0</span>, <span class="number">30</span>, <span class="number">100</span>);</span><br><span class="line">camera.<span class="title function_">lookAt</span>(<span class="keyword">new</span> <span class="variable constant_">THREE</span>.<span class="title class_">Vector3</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>));</span><br></pre></td></tr></table></figure>

<h3 id="添加光源"><a href="#添加光源" class="headerlink" title="添加光源"></a>添加光源</h3><p>本示例中主要添加了两种光源：<code>DirectionalLight</code> 用于产生阴影，调节页面亮度、<code>AmbientLight</code> 用于渲染环境氛围。</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 直射光</span></span><br><span class="line"><span class="keyword">const</span> light = <span class="keyword">new</span> <span class="variable constant_">THREE</span>.<span class="title class_">DirectionalLight</span>(<span class="number">0xffffff</span>, <span class="number">1</span>);</span><br><span class="line">light.<span class="property">intensity</span> = <span class="number">1</span>;</span><br><span class="line">light.<span class="property">position</span>.<span class="title function_">set</span>(<span class="number">16</span>, <span class="number">16</span>, <span class="number">8</span>);</span><br><span class="line">light.<span class="property">castShadow</span> = <span class="literal">true</span>;</span><br><span class="line">light.<span class="property">shadow</span>.<span class="property">mapSize</span>.<span class="property">width</span> = <span class="number">512</span> * <span class="number">12</span>;</span><br><span class="line">light.<span class="property">shadow</span>.<span class="property">mapSize</span>.<span class="property">height</span> = <span class="number">512</span> * <span class="number">12</span>;</span><br><span class="line">light.<span class="property">shadow</span>.<span class="property">camera</span>.<span class="property">top</span> = <span class="number">40</span>;</span><br><span class="line">light.<span class="property">shadow</span>.<span class="property">camera</span>.<span class="property">bottom</span> = -<span class="number">40</span>;</span><br><span class="line">light.<span class="property">shadow</span>.<span class="property">camera</span>.<span class="property">left</span> = -<span class="number">40</span>;</span><br><span class="line">light.<span class="property">shadow</span>.<span class="property">camera</span>.<span class="property">right</span> = <span class="number">40</span>;</span><br><span class="line">scene.<span class="title function_">add</span>(light);</span><br><span class="line"><span class="comment">// 环境光</span></span><br><span class="line"><span class="keyword">const</span> ambientLight = <span class="keyword">new</span> <span class="variable constant_">THREE</span>.<span class="title class_">AmbientLight</span>(<span class="number">0xcfffff</span>);</span><br><span class="line">ambientLight.<span class="property">intensity</span> = <span class="number">1</span>;</span><br><span class="line">scene.<span class="title function_">add</span>(ambientLight);</span><br></pre></td></tr></table></figure>

<h3 id="加载进度管理"><a href="#加载进度管理" class="headerlink" title="加载进度管理"></a>加载进度管理</h3><p>使用 <code>THREE.LoadingManager</code> 管理页面模型加载进度，在它的回调函数中执行一些与加载进度相关的方法。本例中的页面加载进度就是在 <code>onProgress</code> 中完成的，当页面加载进度为 <code>100%</code> 时，执行 <code>TWEEN</code> 镜头补间动画。</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">const</span> manager = <span class="keyword">new</span> <span class="variable constant_">THREE</span>.<span class="title class_">LoadingManager</span>();</span><br><span class="line">manager.<span class="property">onStart</span> = <span class="function">(<span class="params">url, loaded, total</span>) =&gt;</span> &#123;&#125;;</span><br><span class="line">manager.<span class="property">onLoad</span> = <span class="function">() =&gt;</span> &#123; <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&#x27;Loading complete!&#x27;</span>)&#125;;</span><br><span class="line">manager.<span class="property">onProgress</span> = <span class="function">(<span class="params">url, loaded, total</span>) =&gt;</span> &#123;</span><br><span class="line">  <span class="keyword">if</span> (<span class="title class_">Math</span>.<span class="title function_">floor</span>(loaded / total * <span class="number">100</span>) === <span class="number">100</span>) &#123;</span><br><span class="line">    <span class="variable language_">this</span>.<span class="title function_">setState</span>(&#123; <span class="attr">loadingProcess</span>: <span class="title class_">Math</span>.<span class="title function_">floor</span>(loaded / total * <span class="number">100</span>) &#125;);</span><br><span class="line">    <span class="comment">// 镜头补间动画</span></span><br><span class="line">    <span class="title class_">Animations</span>.<span class="title function_">animateCamera</span>(camera, controls, &#123; <span class="attr">x</span>: <span class="number">0</span>, <span class="attr">y</span>: -<span class="number">1</span>, <span class="attr">z</span>: <span class="number">20</span> &#125;, &#123; <span class="attr">x</span>: <span class="number">0</span>, <span class="attr">y</span>: <span class="number">0</span>, <span class="attr">z</span>: <span class="number">0</span> &#125;, <span class="number">3600</span>, <span class="function">() =&gt;</span> &#123;&#125;);</span><br><span class="line">  &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">    <span class="variable language_">this</span>.<span class="title function_">setState</span>(&#123; <span class="attr">loadingProcess</span>: <span class="title class_">Math</span>.<span class="title function_">floor</span>(loaded / total * <span class="number">100</span>) &#125;);</span><br><span class="line">  &#125;</span><br><span class="line">&#125;;</span><br></pre></td></tr></table></figure>

<h3 id="创建地面"><a href="#创建地面" class="headerlink" title="创建地面"></a>创建地面</h3><p>本示例中凹凸起伏的地面是使用 <code>Blender</code> 构建模型，然后导出 <code>glb</code> 格式加载创建的。当然也可以只使用 <code>Three.js</code> 自带平面网格加凹凸贴图也可以实现类似的效果。使用 <code>Blender</code> 自建模型的优点在于可以自由可视化地调整地面的起伏效果。</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> loader = <span class="keyword">new</span> <span class="variable constant_">THREE</span>.<span class="title class_">GLTFLoader</span>(manager);</span><br><span class="line">loader.<span class="title function_">load</span>(landModel, <span class="keyword">function</span> (<span class="params">mesh</span>) &#123;</span><br><span class="line">  mesh.<span class="property">scene</span>.<span class="title function_">traverse</span>(<span class="keyword">function</span> (<span class="params">child</span>) &#123;</span><br><span class="line">    <span class="keyword">if</span> (child.<span class="property">isMesh</span>) &#123;</span><br><span class="line">      child.<span class="property">material</span>.<span class="property">metalness</span> = <span class="number">.1</span>;</span><br><span class="line">      child.<span class="property">material</span>.<span class="property">roughness</span> = <span class="number">.8</span>;</span><br><span class="line">      <span class="comment">// 地面</span></span><br><span class="line">      <span class="keyword">if</span> (child.<span class="property">name</span> === <span class="string">&#x27;Mesh_2&#x27;</span>) &#123;</span><br><span class="line">        child.<span class="property">material</span>.<span class="property">metalness</span> = <span class="number">.5</span>;</span><br><span class="line">        child.<span class="property">receiveShadow</span> = <span class="literal">true</span>;</span><br><span class="line">      &#125;</span><br><span class="line">  &#125;);</span><br><span class="line">  mesh.<span class="property">scene</span>.<span class="property">rotation</span>.<span class="property">y</span> = <span class="title class_">Math</span>.<span class="property">PI</span> / <span class="number">4</span>;</span><br><span class="line">  mesh.<span class="property">scene</span>.<span class="property">position</span>.<span class="title function_">set</span>(<span class="number">15</span>, -<span class="number">20</span>, <span class="number">0</span>);</span><br><span class="line">  mesh.<span class="property">scene</span>.<span class="property">scale</span>.<span class="title function_">set</span>(<span class="number">.9</span>, <span class="number">.9</span>, <span class="number">.9</span>);</span><br><span class="line">  land = mesh.<span class="property">scene</span>;</span><br><span class="line">  scene.<span class="title function_">add</span>(land);</span><br><span class="line">&#125;);</span><br></pre></td></tr></table></figure>

<p><img src="https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/79b71ebf1cfc4e95a8fb3f64461108c8~tplv-k3u1fbpfcp-watermark.awebp"></p>
<h3 id="创建冬奥吉祥物冰墩墩"><a href="#创建冬奥吉祥物冰墩墩" class="headerlink" title="创建冬奥吉祥物冰墩墩"></a>创建冬奥吉祥物冰墩墩</h3><p>现在添加可爱的冬奥会吉祥物熊猫冰墩墩 <code>🐼</code>，冰墩墩同样是使用 <code>glb</code> 格式模型加载的。它的原始模型来源于这里，从这个网站免费现在模型后，原模型是使用 <code>3D max</code> 建的我发现并不能直接用在网页中，需要在 <code>Blender</code> 中转换模型格式，还需要调整调整模型的贴图法线，才能还原渲染图效果。</p>
<p><strong>原模型</strong>：</p>
<p><img src="https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/40de3d65b202431bac1f0673f9f3882e~tplv-k3u1fbpfcp-watermark.awebp"></p>
<p><strong>冰墩墩贴图</strong>:</p>
<p><img src="https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/78bba0afd14345bfbfdbb5ffa44aecb3~tplv-k3u1fbpfcp-watermark.awebp"></p>
<p><strong>转换成 Blender 支持的模型，并在 Blender 中调整模型贴图法线、并添加贴图</strong>:</p>
<p><img src="https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/8881a2307d2a40e1abef87201a26ec9d~tplv-k3u1fbpfcp-watermark.awebp"></p>
<p><strong>导出 glb 格式</strong>:</p>
<p><img src="https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/55b45df468634f3c9670c4b4d03fe6c9~tplv-k3u1fbpfcp-watermark.awebp"></p>
<blockquote>
<p><code>📖</code> 在 <code>Blender</code> 中给模型添加贴图教程传送门：在 Blender 中怎么给模型贴图</p>
</blockquote>
<p>仔细观察<code>冰墩墩 🐼</code>可以发现，它的外面有一层<strong>透明塑料或玻璃质感外壳</strong>，这个效果可以通过修改模型的透明度、金属度、粗糙度等材质参数实现，最后就可以渲染出如 <code>👆 banner图</code> 所示的那种效果，具体如以下代码所示。</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line">loader.<span class="title function_">load</span>(bingdundunModel, <span class="function"><span class="params">mesh</span> =&gt;</span> &#123;</span><br><span class="line">  mesh.<span class="property">scene</span>.<span class="title function_">traverse</span>(<span class="function"><span class="params">child</span> =&gt;</span> &#123;</span><br><span class="line">    <span class="keyword">if</span> (child.<span class="property">isMesh</span>) &#123;</span><br><span class="line">      <span class="comment">// 内部</span></span><br><span class="line">      <span class="keyword">if</span> (child.<span class="property">name</span> === <span class="string">&#x27;oldtiger001&#x27;</span>) &#123;</span><br><span class="line">        child.<span class="property">material</span>.<span class="property">metalness</span> = <span class="number">.5</span></span><br><span class="line">        child.<span class="property">material</span>.<span class="property">roughness</span> = <span class="number">.8</span></span><br><span class="line">      &#125;</span><br><span class="line">      <span class="comment">// 半透明外壳</span></span><br><span class="line">      <span class="keyword">if</span> (child.<span class="property">name</span> === <span class="string">&#x27;oldtiger002&#x27;</span>) &#123;</span><br><span class="line">        child.<span class="property">material</span>.<span class="property">transparent</span> = <span class="literal">true</span>;</span><br><span class="line">        child.<span class="property">material</span>.<span class="property">opacity</span> = <span class="number">.5</span></span><br><span class="line">        child.<span class="property">material</span>.<span class="property">metalness</span> = <span class="number">.2</span></span><br><span class="line">        child.<span class="property">material</span>.<span class="property">roughness</span> = <span class="number">0</span></span><br><span class="line">        child.<span class="property">material</span>.<span class="property">refractionRatio</span> = <span class="number">1</span></span><br><span class="line">        child.<span class="property">castShadow</span> = <span class="literal">true</span>;</span><br><span class="line">      &#125;</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;);</span><br><span class="line">  mesh.<span class="property">scene</span>.<span class="property">rotation</span>.<span class="property">y</span> = <span class="title class_">Math</span>.<span class="property">PI</span> / <span class="number">24</span>;</span><br><span class="line">  mesh.<span class="property">scene</span>.<span class="property">position</span>.<span class="title function_">set</span>(-<span class="number">8</span>, -<span class="number">12</span>, <span class="number">0</span>);</span><br><span class="line">  mesh.<span class="property">scene</span>.<span class="property">scale</span>.<span class="title function_">set</span>(<span class="number">24</span>, <span class="number">24</span>, <span class="number">24</span>);</span><br><span class="line">  scene.<span class="title function_">add</span>(mesh.<span class="property">scene</span>);</span><br><span class="line">&#125;);</span><br></pre></td></tr></table></figure>

<h3 id="创建奥运五环"><a href="#创建奥运五环" class="headerlink" title="创建奥运五环"></a>创建奥运五环</h3><p>奥运五环由基础几何模型圆环面 <code>TorusGeometry</code> 来实现，创建五个圆环面，并调整它们的材质颜色和位置来构成<strong>蓝黑红黄绿</strong>顺序的五环结构。五环材质使用的是 <code>MeshLambertMaterial</code>。</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">const</span> fiveCycles = [</span><br><span class="line">  &#123; <span class="attr">key</span>: <span class="string">&#x27;cycle_0&#x27;</span>, <span class="attr">color</span>: <span class="number">0x0885c2</span>, <span class="attr">position</span>: &#123; <span class="attr">x</span>: -<span class="number">250</span>, <span class="attr">y</span>: <span class="number">0</span>, <span class="attr">z</span>: <span class="number">0</span> &#125;&#125;,</span><br><span class="line">  &#123; <span class="attr">key</span>: <span class="string">&#x27;cycle_1&#x27;</span>, <span class="attr">color</span>: <span class="number">0x000000</span>, <span class="attr">position</span>: &#123; <span class="attr">x</span>: -<span class="number">10</span>, <span class="attr">y</span>: <span class="number">0</span>, <span class="attr">z</span>: <span class="number">5</span> &#125;&#125;,</span><br><span class="line">  &#123; <span class="attr">key</span>: <span class="string">&#x27;cycle_2&#x27;</span>, <span class="attr">color</span>: <span class="number">0xed334e</span>, <span class="attr">position</span>: &#123; <span class="attr">x</span>: <span class="number">230</span>, <span class="attr">y</span>: <span class="number">0</span>, <span class="attr">z</span>: <span class="number">0</span> &#125;&#125;,</span><br><span class="line">  &#123; <span class="attr">key</span>: <span class="string">&#x27;cycle_3&#x27;</span>, <span class="attr">color</span>: <span class="number">0xfbb132</span>, <span class="attr">position</span>: &#123; <span class="attr">x</span>: -<span class="number">125</span>, <span class="attr">y</span>: -<span class="number">100</span>, <span class="attr">z</span>: -<span class="number">5</span> &#125;&#125;,</span><br><span class="line">  &#123; <span class="attr">key</span>: <span class="string">&#x27;cycle_4&#x27;</span>, <span class="attr">color</span>: <span class="number">0x1c8b3c</span>, <span class="attr">position</span>: &#123; <span class="attr">x</span>: <span class="number">115</span>, <span class="attr">y</span>: -<span class="number">100</span>, <span class="attr">z</span>: <span class="number">10</span> &#125;&#125;</span><br><span class="line">];</span><br><span class="line">fiveCycles.<span class="title function_">map</span>(<span class="function"><span class="params">item</span> =&gt;</span> &#123;</span><br><span class="line">  <span class="keyword">let</span> cycleMesh = <span class="keyword">new</span> <span class="variable constant_">THREE</span>.<span class="title class_">Mesh</span>(<span class="keyword">new</span> <span class="variable constant_">THREE</span>.<span class="title class_">TorusGeometry</span>(<span class="number">100</span>, <span class="number">10</span>, <span class="number">10</span>, <span class="number">50</span>), <span class="keyword">new</span> <span class="variable constant_">THREE</span>.<span class="title class_">MeshLambertMaterial</span>(&#123;</span><br><span class="line">    <span class="attr">color</span>: <span class="keyword">new</span> <span class="variable constant_">THREE</span>.<span class="title class_">Color</span>(item.<span class="property">color</span>),</span><br><span class="line">    <span class="attr">side</span>: <span class="variable constant_">THREE</span>.<span class="property">DoubleSide</span></span><br><span class="line">  &#125;));</span><br><span class="line">  cycleMesh.<span class="property">castShadow</span> = <span class="literal">true</span>;</span><br><span class="line">  cycleMesh.<span class="property">position</span>.<span class="title function_">set</span>(item.<span class="property">position</span>.<span class="property">x</span>, item.<span class="property">position</span>.<span class="property">y</span>, item.<span class="property">position</span>.<span class="property">z</span>);</span><br><span class="line">  meshes.<span class="title function_">push</span>(cycleMesh);</span><br><span class="line">  fiveCyclesGroup.<span class="title function_">add</span>(cycleMesh);</span><br><span class="line">&#125;);</span><br><span class="line">fiveCyclesGroup.<span class="property">scale</span>.<span class="title function_">set</span>(<span class="number">.036</span>, <span class="number">.036</span>, <span class="number">.036</span>);</span><br><span class="line">fiveCyclesGroup.<span class="property">position</span>.<span class="title function_">set</span>(<span class="number">0</span>, <span class="number">10</span>, -<span class="number">8</span>);</span><br><span class="line">scene.<span class="title function_">add</span>(fiveCyclesGroup);</span><br></pre></td></tr></table></figure>

<h4 id="💡-TorusGeometry-圆环面"><a href="#💡-TorusGeometry-圆环面" class="headerlink" title="💡 TorusGeometry 圆环面"></a><code>💡</code> TorusGeometry 圆环面</h4><p><code>TorusGeometry</code> 一个用于生成圆环几何体的类。</p>
<p><strong>构造函数</strong>：</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="title class_">TorusGeometry</span>(<span class="attr">radius</span>: <span class="title class_">Float</span>, <span class="attr">tube</span>: <span class="title class_">Float</span>, <span class="attr">radialSegments</span>: <span class="title class_">Integer</span>, <span class="attr">tubularSegments</span>: <span class="title class_">Integer</span>, <span class="attr">arc</span>: <span class="title class_">Float</span>)</span><br></pre></td></tr></table></figure>

<ul>
<li><code>radius</code>：圆环的半径，从圆环的中心到管道（横截面）的中心。默认值是 <code>1</code>。</li>
<li><code>tube</code>：管道的半径，默认值为 <code>0.4</code>。</li>
<li><code>radialSegments</code>：圆环的分段数，默认值为 <code>8</code>。</li>
<li><code>tubularSegments</code>：管道的分段数，默认值为 <code>6</code>。</li>
<li><code>arc</code>：圆环的圆心角（单位是弧度），默认值为 <code>Math.PI * 2</code>。</li>
</ul>
<h4 id="💡-MeshLambertMaterial-非光泽表面材质"><a href="#💡-MeshLambertMaterial-非光泽表面材质" class="headerlink" title="💡 MeshLambertMaterial 非光泽表面材质"></a><code>💡</code> MeshLambertMaterial 非光泽表面材质</h4><p>一种非光泽表面的材质，没有镜面高光。该材质使用基于非物理的 <code>Lambertian</code> 模型来计算反射率。这可以很好地模拟一些表面（例如未经处理的木材或石材），但不能模拟具有镜面高光的光泽表面（例如涂漆木材）。</p>
<p><strong>构造函数</strong>：</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="title class_">MeshLambertMaterial</span>(parameters : <span class="title class_">Object</span>)</span><br></pre></td></tr></table></figure>

<ul>
<li><code>parameters</code>：（可选）用于定义材质外观的对象，具有一个或多个属性。材质的任何属性都可以从此处传入。</li>
</ul>
<h3 id="创建旗帜"><a href="#创建旗帜" class="headerlink" title="创建旗帜"></a>创建旗帜</h3><p>旗面模型是从 sketchfab 下载的，还需要一个旗杆，可以在 <code>Blender</code>中添加了一个柱状立方体，并调整好合适的长宽高和旗面结合起来。</p>
<p><img src="https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/21d2e80561024cb38a89dc75b3e09d50~tplv-k3u1fbpfcp-watermark.awebp"></p>
<p><strong>旗面贴图</strong>：</p>
<p><img src="https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/6a1fc0345766451a890ae2d19ef0ad38~tplv-k3u1fbpfcp-watermark.awebp"></p>
<p>旗面添加了动画，需要在代码中执行动画帧播放。</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br></pre></td><td class="code"><pre><span class="line">loader.<span class="title function_">load</span>(flagModel, <span class="function"><span class="params">mesh</span> =&gt;</span> &#123;</span><br><span class="line">  mesh.<span class="property">scene</span>.<span class="title function_">traverse</span>(<span class="function"><span class="params">child</span> =&gt;</span> &#123;</span><br><span class="line">    <span class="keyword">if</span> (child.<span class="property">isMesh</span>) &#123;</span><br><span class="line">      child.<span class="property">castShadow</span> = <span class="literal">true</span>;</span><br><span class="line">      <span class="comment">// 旗帜</span></span><br><span class="line">      <span class="keyword">if</span> (child.<span class="property">name</span> === <span class="string">&#x27;mesh_0001&#x27;</span>) &#123;</span><br><span class="line">        child.<span class="property">material</span>.<span class="property">metalness</span> = <span class="number">.1</span>;</span><br><span class="line">        child.<span class="property">material</span>.<span class="property">roughness</span> = <span class="number">.1</span>;</span><br><span class="line">        child.<span class="property">material</span>.<span class="property">map</span> = <span class="keyword">new</span> <span class="variable constant_">THREE</span>.<span class="title class_">TextureLoader</span>().<span class="title function_">load</span>(flagTexture);</span><br><span class="line">      &#125;</span><br><span class="line">      <span class="comment">// 旗杆</span></span><br><span class="line">      <span class="keyword">if</span> (child.<span class="property">name</span> === <span class="string">&#x27;柱体&#x27;</span>) &#123;</span><br><span class="line">        child.<span class="property">material</span>.<span class="property">metalness</span> = <span class="number">.6</span>;</span><br><span class="line">        child.<span class="property">material</span>.<span class="property">roughness</span> = <span class="number">0</span>;</span><br><span class="line">        child.<span class="property">material</span>.<span class="property">refractionRatio</span> = <span class="number">1</span>;</span><br><span class="line">        child.<span class="property">material</span>.<span class="property">color</span> = <span class="keyword">new</span> <span class="variable constant_">THREE</span>.<span class="title class_">Color</span>(<span class="number">0xeeeeee</span>);</span><br><span class="line">      &#125;</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;);</span><br><span class="line">  mesh.<span class="property">scene</span>.<span class="property">rotation</span>.<span class="property">y</span> = <span class="title class_">Math</span>.<span class="property">PI</span> / <span class="number">24</span>;</span><br><span class="line">  mesh.<span class="property">scene</span>.<span class="property">position</span>.<span class="title function_">set</span>(<span class="number">2</span>, -<span class="number">7</span>, -<span class="number">1</span>);</span><br><span class="line">  mesh.<span class="property">scene</span>.<span class="property">scale</span>.<span class="title function_">set</span>(<span class="number">4</span>, <span class="number">4</span>, <span class="number">4</span>);</span><br><span class="line">  <span class="comment">// 动画</span></span><br><span class="line">  <span class="keyword">let</span> meshAnimation = mesh.<span class="property">animations</span>[<span class="number">0</span>];</span><br><span class="line">  mixer = <span class="keyword">new</span> <span class="variable constant_">THREE</span>.<span class="title class_">AnimationMixer</span>(mesh.<span class="property">scene</span>);</span><br><span class="line">  <span class="keyword">let</span> animationClip = meshAnimation;</span><br><span class="line">  <span class="keyword">let</span> clipAction = mixer.<span class="title function_">clipAction</span>(animationClip).<span class="title function_">play</span>();</span><br><span class="line">  animationClip = clipAction.<span class="title function_">getClip</span>();</span><br><span class="line">  scene.<span class="title function_">add</span>(mesh.<span class="property">scene</span>);</span><br><span class="line">&#125;);</span><br></pre></td></tr></table></figure>

<h3 id="创建树木"><a href="#创建树木" class="headerlink" title="创建树木"></a>创建树木</h3><p>为了充实画面，营造冬日氛围，于是就添加了几棵松树 <code>🌲</code> 作为装饰。添加松树的时候用到一个技巧非常重要：我们知道因为树的模型非常复杂，有非常多的面数，面数太多会降低页面性能，造成卡顿。本文中使用两个如下图 <code>👇</code> 所示的两个交叉的面来作为树的基座，这样的话树只有两个面数，使用这个技巧可以和大程度上优化页面性能，而且树 <code>🌲</code> 的样子看起来也是有 <code>3D</code> 感的。</p>
<p><img src="https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/bc12379da4b04b18a643b44ad7198408~tplv-k3u1fbpfcp-watermark.awebp"></p>
<p><strong>材质贴图</strong>：</p>
<p><img src="https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/b12aef79902b4607888d3e270bc3ee25~tplv-k3u1fbpfcp-watermark.awebp"></p>
<p>为了使树<strong>只在贴图透明部分透明、其他地方不透明</strong>，并且可以<strong>产生树状阴影而不是长方体阴影</strong>，需要给树模型添加如下 <code>MeshPhysicalMaterial</code>、<code>MeshDepthMaterial</code> 两种材质，两种材质使用同样的纹理贴图，其中 <code>MeshDepthMaterial</code> 添加到模型的 <code>custromMaterial</code> 属性上。</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br></pre></td><td class="code"><pre><span class="line"> <span class="keyword">let</span> treeMaterial = <span class="keyword">new</span> <span class="variable constant_">THREE</span>.<span class="title class_">MeshPhysicalMaterial</span>(&#123;</span><br><span class="line">  <span class="attr">map</span>: <span class="keyword">new</span> <span class="variable constant_">THREE</span>.<span class="title class_">TextureLoader</span>().<span class="title function_">load</span>(treeTexture),</span><br><span class="line">  <span class="attr">transparent</span>: <span class="literal">true</span>,</span><br><span class="line">  <span class="attr">side</span>: <span class="variable constant_">THREE</span>.<span class="property">DoubleSide</span>,</span><br><span class="line">  <span class="attr">metalness</span>: <span class="number">.2</span>,</span><br><span class="line">  <span class="attr">roughness</span>: <span class="number">.8</span>,</span><br><span class="line">  <span class="attr">depthTest</span>: <span class="literal">true</span>,</span><br><span class="line">  <span class="attr">depthWrite</span>: <span class="literal">false</span>,</span><br><span class="line">  <span class="attr">skinning</span>: <span class="literal">false</span>,</span><br><span class="line">  <span class="attr">fog</span>: <span class="literal">false</span>,</span><br><span class="line">  <span class="attr">reflectivity</span>: <span class="number">0.1</span>,</span><br><span class="line">  <span class="attr">refractionRatio</span>: <span class="number">0</span>,</span><br><span class="line">&#125;);</span><br><span class="line"><span class="keyword">let</span> treeCustomDepthMaterial = <span class="keyword">new</span> <span class="variable constant_">THREE</span>.<span class="title class_">MeshDepthMaterial</span>(&#123;</span><br><span class="line">  <span class="attr">depthPacking</span>: <span class="variable constant_">THREE</span>.<span class="property">RGBADepthPacking</span>,</span><br><span class="line">  <span class="attr">map</span>: <span class="keyword">new</span> <span class="variable constant_">THREE</span>.<span class="title class_">TextureLoader</span>().<span class="title function_">load</span>(treeTexture),</span><br><span class="line">  <span class="attr">alphaTest</span>: <span class="number">0.5</span></span><br><span class="line">&#125;);</span><br><span class="line">loader.<span class="title function_">load</span>(treeModel, <span class="function"><span class="params">mesh</span> =&gt;</span> &#123;</span><br><span class="line">  mesh.<span class="property">scene</span>.<span class="title function_">traverse</span>(<span class="function"><span class="params">child</span> =&gt;</span>&#123;</span><br><span class="line">    <span class="keyword">if</span> (child.<span class="property">isMesh</span>) &#123;</span><br><span class="line">      child.<span class="property">material</span> = treeMaterial;</span><br><span class="line">      child.<span class="property">custromMaterial</span> = treeCustomDepthMaterial;</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;);</span><br><span class="line">  mesh.<span class="property">scene</span>.<span class="property">position</span>.<span class="title function_">set</span>(<span class="number">14</span>, -<span class="number">9</span>, <span class="number">0</span>);</span><br><span class="line">  mesh.<span class="property">scene</span>.<span class="property">scale</span>.<span class="title function_">set</span>(<span class="number">16</span>, <span class="number">16</span>, <span class="number">16</span>);</span><br><span class="line">  scene.<span class="title function_">add</span>(mesh.<span class="property">scene</span>);</span><br><span class="line">  <span class="comment">// 克隆另两棵树</span></span><br><span class="line">  <span class="keyword">let</span> tree2 = mesh.<span class="property">scene</span>.<span class="title function_">clone</span>();</span><br><span class="line">  tree2.<span class="property">position</span>.<span class="title function_">set</span>(<span class="number">10</span>, -<span class="number">8</span>, -<span class="number">15</span>);</span><br><span class="line">  tree2.<span class="property">scale</span>.<span class="title function_">set</span>(<span class="number">18</span>, <span class="number">18</span>, <span class="number">18</span>);</span><br><span class="line">  scene.<span class="title function_">add</span>(tree2)</span><br><span class="line">  <span class="comment">// ...</span></span><br><span class="line">&#125;);</span><br></pre></td></tr></table></figure>

<p>实现效果也可以从 <code>👆</code> 上面 <code>Banner</code> 图中可以看到，为了画面更好看，我取消了树的阴影显示。</p>
<blockquote>
<p><code>📌</code> 在 <code>3D</code> 功能开发中，一些不重要的装饰模型都可以采取这种策略来优化。</p>
</blockquote>
<h4 id="💡-MeshDepthMaterial-深度网格材质"><a href="#💡-MeshDepthMaterial-深度网格材质" class="headerlink" title="💡 MeshDepthMaterial 深度网格材质"></a><code>💡</code> MeshDepthMaterial 深度网格材质</h4><p>一种按深度绘制几何体的材质。深度基于相机远近平面，白色最近，黑色最远。</p>
<p><strong>构造函数</strong>：</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="title class_">MeshDepthMaterial</span>(<span class="attr">parameters</span>: <span class="title class_">Object</span>)</span><br></pre></td></tr></table></figure>

<ul>
<li><code>parameters</code>：（可选）用于定义材质外观的对象，具有一个或多个属性。材质的任何属性都可以从此处传入。</li>
</ul>
<p><strong>特殊属性</strong>：</p>
<ul>
<li><code>.depthPacking[Constant]</code>：<code>depth packing</code> 的编码。默认为 <code>BasicDepthPacking</code>。</li>
<li><code>.displacementMap[Texture]</code>：位移贴图会影响网格顶点的位置，与仅影响材质的光照和阴影的其他贴图不同，移位的顶点可以投射阴影，阻挡其他对象，以及充当真实的几何体。</li>
<li><code>.displacementScale[Float]</code>：位移贴图对网格的影响程度（黑色是无位移，白色是最大位移）。如果没有设置位移贴图，则不会应用此值。默认值为 <code>1</code>。</li>
<li><code>.displacementBias[Float]</code>：位移贴图在网格顶点上的偏移量。如果没有设置位移贴图，则不会应用此值。默认值为 <code>0</code>。</li>
</ul>
<h4 id="💡-custromMaterial-自定义材质"><a href="#💡-custromMaterial-自定义材质" class="headerlink" title="💡 custromMaterial 自定义材质"></a><code>💡</code> custromMaterial 自定义材质</h4><p>给网格添加 <code>custromMaterial</code> 自定义材质属性，可以实现透明外围 <code>png</code> 图片贴图的内容区域阴影。</p>
<h3 id="创建雪花"><a href="#创建雪花" class="headerlink" title="创建雪花"></a>创建雪花</h3><p>创建雪花 <code>❄️</code>，就要用到<strong>粒子知识</strong>。<code>THREE.Points</code> 是用来创建点的类，也用来批量管理粒子。本例中创建了 <code>1500</code> 个雪花粒子，并为它们设置了限定三维空间的随机坐标及横向和竖向的随机移动速度。</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 雪花贴图</span></span><br><span class="line"><span class="keyword">let</span> texture = <span class="keyword">new</span> <span class="variable constant_">THREE</span>.<span class="title class_">TextureLoader</span>().<span class="title function_">load</span>(snowTexture);</span><br><span class="line"><span class="keyword">let</span> geometry = <span class="keyword">new</span> <span class="variable constant_">THREE</span>.<span class="title class_">Geometry</span>();</span><br><span class="line"><span class="keyword">let</span> range = <span class="number">100</span>;</span><br><span class="line"><span class="keyword">let</span> pointsMaterial = <span class="keyword">new</span> <span class="variable constant_">THREE</span>.<span class="title class_">PointsMaterial</span>(&#123;</span><br><span class="line">  <span class="attr">size</span>: <span class="number">1</span>,</span><br><span class="line">  <span class="attr">transparent</span>: <span class="literal">true</span>,</span><br><span class="line">  <span class="attr">opacity</span>: <span class="number">0.8</span>,</span><br><span class="line">  <span class="attr">map</span>: texture,</span><br><span class="line">  <span class="comment">// 背景融合</span></span><br><span class="line">  <span class="attr">blending</span>: <span class="variable constant_">THREE</span>.<span class="property">AdditiveBlending</span>,</span><br><span class="line">  <span class="comment">// 景深衰弱</span></span><br><span class="line">  <span class="attr">sizeAttenuation</span>: <span class="literal">true</span>,</span><br><span class="line">  <span class="attr">depthTest</span>: <span class="literal">false</span></span><br><span class="line">&#125;);</span><br><span class="line"><span class="keyword">for</span> (<span class="keyword">let</span> i = <span class="number">0</span>; i &lt; <span class="number">1500</span>; i++) &#123;</span><br><span class="line">  <span class="keyword">let</span> vertice = <span class="keyword">new</span> <span class="variable constant_">THREE</span>.<span class="title class_">Vector3</span>(<span class="title class_">Math</span>.<span class="title function_">random</span>() * range - range / <span class="number">2</span>, <span class="title class_">Math</span>.<span class="title function_">random</span>() * range * <span class="number">1.5</span>, <span class="title class_">Math</span>.<span class="title function_">random</span>() * range - range / <span class="number">2</span>);</span><br><span class="line">  <span class="comment">// 纵向移速</span></span><br><span class="line">  vertice.<span class="property">velocityY</span> = <span class="number">0.1</span> + <span class="title class_">Math</span>.<span class="title function_">random</span>() / <span class="number">3</span>;</span><br><span class="line">  <span class="comment">// 横向移速</span></span><br><span class="line">  vertice.<span class="property">velocityX</span> = (<span class="title class_">Math</span>.<span class="title function_">random</span>() - <span class="number">0.5</span>) / <span class="number">3</span>;</span><br><span class="line">  <span class="comment">// 加入到几何</span></span><br><span class="line">  geometry.<span class="property">vertices</span>.<span class="title function_">push</span>(vertice);</span><br><span class="line">&#125;</span><br><span class="line">geometry.<span class="title function_">center</span>();</span><br><span class="line">points = <span class="keyword">new</span> <span class="variable constant_">THREE</span>.<span class="title class_">Points</span>(geometry, pointsMaterial);</span><br><span class="line">points.<span class="property">position</span>.<span class="property">y</span> = -<span class="number">30</span>;</span><br><span class="line">scene.<span class="title function_">add</span>(points);</span><br></pre></td></tr></table></figure>

<h4 id="💡-Points-粒子"><a href="#💡-Points-粒子" class="headerlink" title="💡 Points 粒子"></a><code>💡</code> Points 粒子</h4><p><code>Three.js</code> 中，雨 <code>🌧️</code>、雪 <code>❄️</code>、云 <code>☁️</code>、星辰 <code>✨</code> 等生活中常见的粒子都可以使用 <code>Points</code> 来模拟实现。</p>
<p><strong>构造函数</strong>：</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">new</span> <span class="variable constant_">THREE</span>.<span class="title class_">Points</span>(geometry, material);</span><br></pre></td></tr></table></figure>

<ul>
<li>构造函数可以接受两个参数，一个几何体和一个材质，几何体参数用来制定粒子的位置坐标，材质参数用来格式化粒子；</li>
<li>可以基于简单几何体对象如 <code>BoxGeometry</code>、<code>SphereGeometry</code>等作为粒子系统的参数；</li>
<li>一般来讲，需要自己指定顶点来确定粒子的位置。</li>
</ul>
<h4 id="💡-PointsMaterial-点材质"><a href="#💡-PointsMaterial-点材质" class="headerlink" title="💡 PointsMaterial 点材质"></a><code>💡</code> PointsMaterial 点材质</h4><p>通过 <code>THREE.PointsMaterial</code> 可以设置粒子的属性参数，是 <code>Points</code> 使用的默认材质。</p>
<p><strong>构造函数</strong>：</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="title class_">PointsMaterial</span>(parameters : <span class="title class_">Object</span>)</span><br></pre></td></tr></table></figure>

<ul>
<li><code>parameters</code>：（可选）用于定义材质外观的对象，具有一个或多个属性。材质的任何属性都可以从此处传入。</li>
</ul>
<h4 id="💡-材质属性-blending"><a href="#💡-材质属性-blending" class="headerlink" title="💡 材质属性 .blending"></a><code>💡</code> 材质属性 .blending</h4><p>材质的<code>.blending</code> 属性主要控制纹理融合的叠加方式，<code>.blending</code> 属性的值包括：</p>
<ul>
<li><code>THREE.NormalBlending</code>：默认值</li>
<li><code>THREE.AdditiveBlending</code>：加法融合模式</li>
<li><code>THREE.SubtractiveBlending</code>：减法融合模式</li>
<li><code>THREE.MultiplyBlending</code>：乘法融合模式</li>
<li><code>THREE.CustomBlending</code>：自定义融合模式，与 <code>.blendSrc</code>, <code>.blendDst</code> 或 <code>.blendEquation</code> 属性组合使用</li>
</ul>
<h4 id="💡-材质属性-sizeAttenuation"><a href="#💡-材质属性-sizeAttenuation" class="headerlink" title="💡 材质属性 .sizeAttenuation"></a><code>💡</code> 材质属性 .sizeAttenuation</h4><p>粒子的大小是否会被相机深度衰减，默认为 <code>true</code>（仅限透视相机）。</p>
<h4 id="💡-Three-js-向量"><a href="#💡-Three-js-向量" class="headerlink" title="💡 Three.js 向量"></a><code>💡</code> Three.js 向量</h4><p>几维向量就有几个分量，二维向量 <code>Vector2</code> 有 <code>x</code> 和 <code>y</code> 两个分量，三维向量 <code>Vector3</code> 有<code>x</code>、<code>y</code>、<code>z</code> 三个分量，四维向量 <code>Vector4</code> 有 <code>x</code>、<code>y</code>、<code>z</code>、<code>w</code> 四个分量。</p>
<p><strong>相关 API</strong>：</p>
<ul>
<li><code>Vector2</code>：二维向量</li>
<li><code>Vector3</code>：三维向量</li>
<li><code>Vector4</code>：四维向量</li>
</ul>
<h3 id="镜头控制、缩放适配、动画"><a href="#镜头控制、缩放适配、动画" class="headerlink" title="镜头控制、缩放适配、动画"></a>镜头控制、缩放适配、动画</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br></pre></td><td class="code"><pre><span class="line">controls = <span class="keyword">new</span> <span class="title class_">OrbitControls</span>(camera, renderer.<span class="property">domElement</span>);</span><br><span class="line">controls.<span class="property">target</span>.<span class="title function_">set</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>);</span><br><span class="line">controls.<span class="property">enableDamping</span> = <span class="literal">true</span>;</span><br><span class="line"><span class="comment">// 禁用平移</span></span><br><span class="line">controls.<span class="property">enablePan</span> = <span class="literal">false</span>;</span><br><span class="line"><span class="comment">// 禁用缩放</span></span><br><span class="line">controls.<span class="property">enableZoom</span> = <span class="literal">false</span>;</span><br><span class="line"><span class="comment">// 垂直旋转角度限制</span></span><br><span class="line">controls.<span class="property">minPolarAngle</span> = <span class="number">1.4</span>;</span><br><span class="line">controls.<span class="property">maxPolarAngle</span> = <span class="number">1.8</span>;</span><br><span class="line"><span class="comment">// 水平旋转角度限制</span></span><br><span class="line">controls.<span class="property">minAzimuthAngle</span> = -<span class="number">.6</span>;</span><br><span class="line">controls.<span class="property">maxAzimuthAngle</span> = <span class="number">.6</span>;</span><br><span class="line"><span class="variable language_">window</span>.<span class="title function_">addEventListener</span>(<span class="string">&#x27;resize&#x27;</span>, <span class="function">() =&gt;</span> &#123;</span><br><span class="line">  camera.<span class="property">aspect</span> = <span class="variable language_">window</span>.<span class="property">innerWidth</span> / <span class="variable language_">window</span>.<span class="property">innerHeight</span>;</span><br><span class="line">  camera.<span class="title function_">updateProjectionMatrix</span>();</span><br><span class="line">  renderer.<span class="title function_">setSize</span>(<span class="variable language_">window</span>.<span class="property">innerWidth</span>, <span class="variable language_">window</span>.<span class="property">innerHeight</span>);</span><br><span class="line">&#125;, <span class="literal">false</span>);</span><br><span class="line"><span class="keyword">function</span> <span class="title function_">animate</span>(<span class="params"></span>) &#123;</span><br><span class="line">  <span class="title function_">requestAnimationFrame</span>(animate);</span><br><span class="line">  renderer.<span class="title function_">render</span>(scene, camera);</span><br><span class="line">  controls &amp;&amp; controls.<span class="title function_">update</span>();</span><br><span class="line">  <span class="comment">// 旗帜动画更新</span></span><br><span class="line">  mixer &amp;&amp; mixer.<span class="title function_">update</span>(<span class="keyword">new</span> <span class="variable constant_">THREE</span>.<span class="title class_">Clock</span>().<span class="title function_">getDelta</span>());</span><br><span class="line">  <span class="comment">// 镜头动画</span></span><br><span class="line">  <span class="variable constant_">TWEEN</span> &amp;&amp; <span class="variable constant_">TWEEN</span>.<span class="title function_">update</span>();</span><br><span class="line">  <span class="comment">// 五环自转</span></span><br><span class="line">  fiveCyclesGroup &amp;&amp; (fiveCyclesGroup.<span class="property">rotation</span>.<span class="property">y</span> += <span class="number">.01</span>);</span><br><span class="line">  <span class="comment">// 顶点变动之后需要更新，否则无法实现雨滴特效</span></span><br><span class="line">  points.<span class="property">geometry</span>.<span class="property">verticesNeedUpdate</span> = <span class="literal">true</span>;</span><br><span class="line">  <span class="comment">// 雪花动画更新</span></span><br><span class="line">  <span class="keyword">let</span> vertices = points.<span class="property">geometry</span>.<span class="property">vertices</span>;</span><br><span class="line">  vertices.<span class="title function_">forEach</span>(<span class="keyword">function</span> (<span class="params">v</span>) &#123;</span><br><span class="line">    v.<span class="property">y</span> = v.<span class="property">y</span> - (v.<span class="property">velocityY</span>);</span><br><span class="line">    v.<span class="property">x</span> = v.<span class="property">x</span> - (v.<span class="property">velocityX</span>);</span><br><span class="line">    <span class="keyword">if</span> (v.<span class="property">y</span> &lt;= <span class="number">0</span>) v.<span class="property">y</span> = <span class="number">60</span>;</span><br><span class="line">    <span class="keyword">if</span> (v.<span class="property">x</span> &lt;= -<span class="number">20</span> || v.<span class="property">x</span> &gt;= <span class="number">20</span>) v.<span class="property">velocityX</span> = v.<span class="property">velocityX</span> * -<span class="number">1</span>;</span><br><span class="line">  &#125;);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<blockquote>
<p><code>🔗</code> 完整代码：<span class="exturl" data-url="aHR0cHM6Ly9naXRodWIuY29tL2RyYWdvbmlyLzNkL3RyZWUvbWFzdGVyL3NyYy9jb250YWluZXJzL09seW1waWM=">https://github.com/dragonir/3d/tree/master/src/containers/Olympic<i class="fa fa-external-link-alt"></i></span></p>
</blockquote>
<h2 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h2><p><code>💡</code> 本文中主要包含的新知识点包括：</p>
<ul>
<li><code>TorusGeometry</code> 圆环面</li>
<li><code>MeshLambertMaterial</code> 非光泽表面材质</li>
<li><code>MeshDepthMaterial</code> 深度网格材质</li>
<li><code>custromMaterial</code> 自定义材质</li>
<li><code>Points</code> 粒子</li>
<li><code>PointsMaterial</code> 点材质</li>
<li>材质属性 <code>.blending</code>、<code>.sizeAttenuation</code></li>
<li><code>Three.js</code> 向量</li>
</ul>
<p><strong>进一步优化的空间</strong>:</p>
<ul>
<li>添加更多的交互功能、界面样式进一步优化；</li>
<li>吉祥物冰墩墩添加骨骼动画，并可以通过鼠标和键盘控制其移动和交互。</li>
</ul>
<hr>
<p>如此硬核的项目，真的是膜拜 <code>dragonir</code> 大牛。</p>
<blockquote>
<p>声明：本文转载自 dragonir，侵删致歉<br>原文链接：<span class="exturl" data-url="aHR0cHM6Ly9qdWVqaW4uY24vcG9zdC83MDYwMjkyOTQzNjA4ODA3NDYw">https://juejin.cn/post/7060292943608807460<i class="fa fa-external-link-alt"></i></span></p>
</blockquote>

    </div>

    
    
    

    <footer class="post-footer">

        </br>
        <div class="official-accounts">
             <a target="_blank" rel="noopener" href="https://cdn.jsdelivr.net/gh/PDPENG/jason-storage/blog-img/Jason%20wechat%20account.png">
                 <img src="/images/official-accounts.png" width="80%">
             </a>
        </div>
          <div class="reward-container">
  <div>Thank you for your support to Jason ~</div>
  <button>
    赞赏
  </button>
  <div class="post-reward">
      <div>
        <img src="/images/wechatpay.png" alt="董哲朋 微信">
        <span>微信</span>
      </div>
      <div>
        <img src="/images/alipay.png" alt="董哲朋 支付宝">
        <span>支付宝</span>
      </div>

  </div>
</div>

          

<div class="post-copyright">
<ul>
  <li class="post-copyright-author">
      <strong>本文作者： </strong>董哲朋
  </li>
  <li class="post-copyright-link">
      <strong>本文链接：</strong>
      <a href="https://pdpeng.github.io/2022/02/10/3d-olympics/" title="超震撼! 裸眼 3D 看冬奥">https://pdpeng.github.io/2022/02/10/3d-olympics/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <span class="exturl" data-url="aHR0cHM6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL2xpY2Vuc2VzL2J5LW5jLXNhLzQuMC8="><i class="fab fa-fw fa-creative-commons"></i>BY-NC-SA</span> 许可协议。转载请注明出处！
  </li>
</ul>
</div>

          <div class="post-tags">
              <a href="/tags/%E8%AE%A1%E7%AE%97%E6%9C%BA%E8%A7%86%E8%A7%89/" rel="tag"><i class="fa fa-tag"></i> 计算机视觉</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/2022/02/17/cdn-config/" rel="prev" title="CDN 网站部署全站加速服务">
                  <i class="fa fa-chevron-left"></i> CDN 网站部署全站加速服务
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/2022/02/08/python-turtle-BingDwenDwen/" rel="next" title="你还没有抢到冰墩墩?">
                  你还没有抢到冰墩墩? <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






    <div class="comments utterances-container"></div>
</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">
<div class="copyright">
  &copy; 2020 – 
  <span itemprop="copyrightYear">2025</span>
  <span class="with-love">
    <i class="fa fa-code"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">董哲朋


<div class="sitetime" style="display: inline-block;">
<span id="sitetime"></span>
<script language=javascript>
	function siteTime(){
		window.setTimeout("siteTime()", 1000);
		var seconds = 1000;
		var minutes = seconds * 60;
		var hours = minutes * 60;
		var days = hours * 24;
		var years = days * 365;
		var today = new Date();
		var todayYear = today.getFullYear();
		var todayMonth = today.getMonth()+1;
		var todayDate = today.getDate();
		var todayHour = today.getHours();
		var todayMinute = today.getMinutes();
		var todaySecond = today.getSeconds();
		var t1 = Date.UTC(2020,09,23,13,15,00); //北京时间 2021-09-23 13:15:00
		var t2 = Date.UTC(todayYear,todayMonth,todayDate,todayHour,todayMinute,todaySecond);
		var diff = t2-t1;
		var diffYears = Math.floor(diff/years);
		var diffDays = Math.floor((diff/days)-diffYears*365);
		var diffHours = Math.floor((diff-(diffYears*365+diffDays)*days)/hours);
		var diffMinutes = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours)/minutes);
		var diffSeconds = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours-diffMinutes*minutes)/seconds);
		document.getElementById("sitetime").innerHTML=" 本站已安全运行 "+diffYears+" 年 "+diffDays+" 天 "+diffHours+" 小时 "+diffMinutes+" 分钟 "+diffSeconds+" 秒 ";
	}
	siteTime();
</script>
</div>
  </span>
</div>
<div class="wordcount" style="display: inline-block;">
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-line"></i>
    </span>
      <span>站点总字数：</span>
    <span title="站点总字数">312k</span>
  </span>
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
      <span>站点阅读时长 &asymp;</span>
    <span title="站点阅读时长">4:43</span>
  </span>
    <div class="beian" style="display: inline-block;">
        <img src="/images/beian.png" alt=""><span class="exturl" data-url="aHR0cDovL3d3dy5iZWlhbi5nb3YuY24vcG9ydGFsL3JlZ2lzdGVyU3lzdGVtSW5mbz9yZWNvcmRjb2RlPTQxMDU4MTAyMDAwMjQx">豫公网安备 41058102000241号 </span>
        <img src="/images/beian.png" alt=""><span class="exturl" data-url="aHR0cHM6Ly9iZWlhbi5taWl0Lmdvdi5jbg==">豫ICP备2021028259号-1 </span>
    </div>

</div>

    </div>
  </footer>

  
  <script src="https://cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
  <script src="https://cdn.jsdelivr.net/npm/@next-theme/pjax@0.5.0/pjax.min.js" integrity="sha256-3NkoLDrmHLTYj7csHIZSr0MHAFTXth7Ua/DDt4MRUAg=" crossorigin="anonymous"></script>
  <script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
  <script src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js" integrity="sha256-yt2kYMy0w8AbtF89WXb2P1rfjcP/HTHLT7097U8Y5b8=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/schemes/muse.js"></script><script src="/js/next-boot.js"></script><script src="/js/pjax.js"></script>

  
<script src="https://cdn.jsdelivr.net/npm/hexo-generator-searchdb@1.4.0/dist/search.js" integrity="sha256-vXZMYLEqsROAXkEw93GGIvaB2ab+QW6w3+1ahD9nXXA=" crossorigin="anonymous"></script>
<script src="/js/third-party/search/local-search.js"></script>



  <script src="/js/third-party/fancybox.js"></script>


  


  <script class="next-config" data-name="leancloud_visitors" type="application/json">{"enable":true,"app_id":"XnAU2LpE7JlHt34KKmw24BoM-MdYXbMMI","app_key":"vphcyLncudT8YkHIgks4F1r2","server_url":null,"security":false}</script>
  <script src="/js/third-party/statistics/lean-analytics.js"></script>


  

  <script class="next-config" data-name="enableMath" type="application/json">false</script><script class="next-config" data-name="mathjax" type="application/json">{"enable":true,"tags":"none","js":{"url":"https://cdn.jsdelivr.net/npm/mathjax@3.2.0/es5/tex-mml-chtml.js","integrity":"sha256-r+3itOMtGGjap0x+10hu6jW/gZCzxHsoKrOd7gyRSGY="}}</script>
<script src="/js/third-party/math/mathjax.js"></script>


<script src="https://cdn.jsdelivr.net/gh/PDPENG/live2d-widget@latest/autoload.js"></script><script class="next-config" data-name="utterances" type="application/json">{"enable":true,"repo":"PDPENG/pdpeng.github.io","issue_term":"pathname","theme":"preferred-color-scheme"}</script>
<script src="/js/third-party/comments/utterances.js"></script>

</body>
</html>
